NEC Labs America, Princeton, USA
June 6, 2022
https://github.com/thomaslima/2022-SiEPIC-workshop-zeropdk
Email: thomas@nec-labs.com
Computer-aided layout
Procedural layout
# make_chip.py
FLOORPLAN_SAFE = 50
TECHNOLOGY = TECHNOLOGY.layers # TODO refactor
if __name__ == "__main__":
layout = pya.Layout()
dbu = layout.dbu = 0.001
TOP = layout.create_cell("TOP")
origin = pya.DPoint(0, 0)
ex = pya.DVector(1, 0)
ey = rotate90(ex)
# FLOORPLAN
FX, FY = 7850, 3000 # um
layout_box(TOP, layout.layer(TECHNOLOGY["FloorPlan"]),
origin, origin + FX * ex + FY * ey, ex)
# Placing each experiment
placement_list = {
"FeedbackWeightBank_experiment": (
exp.FeedbackWeightBank_experiment, # PCell class
2792.04000, 328.87000, # position
{"angle_ex": 90, "N": 5}, # parameters
),
# ...
}
# Place all PCells in placement_list and export port locations for routing
for name, (klass, x, y, params) in placement_list.items():
exp_ports[name] = klass(name, params=params).place_cell(
TOP, x * ex + y * ey
)
# ...
# Perform routing using exp_ports dictionary
# ...
# Removing the $$$CONTEXT_INFO$$$ top cell (Foundries don't like it)
save_options = pya.SaveLayoutOptions()
save_options.write_context_info = False
# CMC told us to have maximum cell name length of 60 characters
save_options.gds2_max_cellname_length = 60
layout.write("mpw-chip.gds", save_options)
PCells are the foundation of layouts with more than a couple polygons
Routing elements refer to the connections between devices (drawn in PCells). They could be metal traces, optical waveguides, or I/O elements.
The connection between PCells and routing elements are defined in the concept of Ports. The port must contain information on the type of connection, the dimensions of the routing elemenet (e.g. waveguide width), a human-readable name, and positioning.
You probably all know KLayout, but few people make good use of the scripting documentation:
I helped Matthias to release a klayout package in PyPI. It works in a standalone way and is loaded with the Database and Geometry APIs, but not Application or Qt (yet).
pip install klayout
Currently there are pre-built wheels in the following versions:
| OS | Python Version |
|---|---|
| macOS 10.13+ | 3.6, 3.7, 3.8, 3.9, 3.10 |
| linux x64 | 3.6, 3.7, 3.8, 3.9, 3.10 |
| win32, win64 | 3.6, 3.7, 3.8, 3.9, 3.10 |
Note for advanced users: You can attempt to build klayout from source by running python setup.py install on the cloned folder from klayout's github repo.
!pip install klayout
import klayout.db as pya
a = pya.DPoint(1, 2)
b = pya.DVector(0, 1)
a+b
Requirement already satisfied: klayout in /opt/homebrew/Caskroom/miniforge/base/envs/siepic/lib/python3.9/site-packages (0.27.9.post1)
<klayout.dbcore.DPoint at 0x103f00740>
Our lab relies on klayout's database engine to produce masks for MPW manufacturing. To aid collaboration, we open-sourced a tool called zeropdk.
Many foundries only offer PDKs to commercial software with a steep price tag, but are happy to offer libraries of standard components in the .gds format. ZeroPDK allows you to quickly bootstrap a Photonics PDK without necessarily relying on their partners: great for academic users and students. Also great for pro users.
Zeropdk is available with pip install zeropdk and the source code is released in our github page
zeropdk.tech: helps load a tech layer definition from a lyp file.zeropdk.layout: a library of tools for advanced polygon creation (round polygons, waveguides, etc).zeropdk.pcell: contains standard class definitions of PCells, ports and parameters. The idea is to make it compatible with SiEPIC-Tools and Klayout Macro Editor (eventually)!pip install zeropdk
Requirement already satisfied: zeropdk in /opt/homebrew/Caskroom/miniforge/base/envs/siepic/lib/python3.9/site-packages (20.12) Requirement already satisfied: numpy in /opt/homebrew/Caskroom/miniforge/base/envs/siepic/lib/python3.9/site-packages (from zeropdk) (1.22.4) Requirement already satisfied: klayout in /opt/homebrew/Caskroom/miniforge/base/envs/siepic/lib/python3.9/site-packages (from zeropdk) (0.27.9.post1) Requirement already satisfied: scipy in /opt/homebrew/Caskroom/miniforge/base/envs/siepic/lib/python3.9/site-packages (from zeropdk) (1.8.1)
!ls ../demo | grep .lyp
from zeropdk.tech import Tech
EBeam = Tech.load_from_xml('../demo/EBeam.lyp')
EBeam.layers
EBeam.lyp
{'Si': <klayout.dbcore.LayerInfo at 0x1180b0ec0>,
'31_Si_p6nm': <klayout.dbcore.LayerInfo at 0x1180b0f40>,
'Text': <klayout.dbcore.LayerInfo at 0x1180b0e40>,
'Si N': <klayout.dbcore.LayerInfo at 0x1180b09c0>,
'Si N++': <klayout.dbcore.LayerInfo at 0x1180b0dc0>,
'SEM': <klayout.dbcore.LayerInfo at 0x1180b0d40>,
'M1': <klayout.dbcore.LayerInfo at 0x1180b0cc0>,
'12_M2': <klayout.dbcore.LayerInfo at 0x1180b0c40>,
'13_MLopen': <klayout.dbcore.LayerInfo at 0x1180b0bc0>,
'VC': <klayout.dbcore.LayerInfo at 0x1180b0b40>,
'M Heater': <klayout.dbcore.LayerInfo at 0x1180b0ac0>,
'FloorPlan': <klayout.dbcore.LayerInfo at 0x1180b0a40>,
'DevRec': <klayout.dbcore.LayerInfo at 0x1180b0940>,
'PinRec': <klayout.dbcore.LayerInfo at 0x1180b0040>,
'FbrTgt': <klayout.dbcore.LayerInfo at 0x1180b00c0>,
'Errors': <klayout.dbcore.LayerInfo at 0x1180b0140>,
'Lumerical': <klayout.dbcore.LayerInfo at 0x1180b01c0>,
'Waveguide': <klayout.dbcore.LayerInfo at 0x1180b08c0>}
import zeropdk.layout.waveguide_rounding as wav_rounding
wav_rounding.main() # produce some interesting non-Manhattan waveguides
Wrote waveguide_rounding.gds
Contents of waveguide_rounding.gds:
!python ../demo/main_python.py
Wrote to example_mask.gds
# !open example_mask.gds
Open demo/1. Demo - Using SiEPIC cell library.ipynb
Open demo/2. Demo - MZI PCell.ipynb
One goal: enable collaboration reduce dependence on a single designer or specific computer setup.
Powerpoint presentation in person. Might share here later.